<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <style>
        html, body {
            background-color: #f8f8f8;
        }
        .seller_info {
        	display: -webkit-box;
        	display: -webkit-flex;
        	align-items: center;
        	background-color: #fff;
        	padding: 10px 15px;
        }
        .seller_info .seller_info_l .seller_img {
			width: 45px;
			height: 45px;
        }
        .seller_info .seller_info_l .seller_img img {
        	width: 100%;
        	height: 100%;
        	object-fit: cover;
        }
        .seller_info .seller_info_c {
        	width: 0;
        	flex: 1;
        	-webkit-flex: 1;
        	box-flex: 1;
        	-webkit-box-flex: 1;
        	padding: 0 10px;
        	overflow: hidden;
        	text-overflow: ellipsis;
        	white-space: nowrap;
        }
        .seller_info .seller_info_r img {
			height: 13px;
			display: block;
        }
        .title_p {
        	height: 35px;
        	line-height: 41px;
        	padding: 0 15px;
        	font-size: 12px;
        	color: #333;
        }
        .goods_evaluate {
        	background-color: #fff;
        }
        .goods_evaluate .goods_ul .goods_li {
        	border-bottom: 1px solid #e8e8e8;
        }
        .goods_evaluate .goods_ul .goods_li:last-child {
        	border-bottom: none;
        }
        .goods_evaluate .goods_info {
        	color: #333;
        	font-size: 15px;
        	display: -webkit-box;
        	-webkit-box-align: center;
        	padding: 15px;
        }
        .goods_evaluate .goods_info img {
        	width: 12px;
        	margin-left: 8px;
        	display: block;
        }
        .goods_evaluate .goods_info span {
        	font-size: 12px;
        	color: #999;
        	margin-left: 5px;
        	display: block;
        }
        .goods_evaluate .goods_tag {
        	padding-bottom: 10px;
        	padding: 0 21px 10px;
        	border-bottom: 1px solid #e8e8e8;
        }
        .goods_evaluate .goods_tag ul {
            overflow: hidden;
            margin: 0 -5px;
        }
        .goods_evaluate .goods_tag ul li {
            min-width: 25%;
            float: left;
            margin-bottom: 10px;
            padding: 0 5px;
            box-sizing: border-box;
        }
        .goods_evaluate .goods_tag ul li .tag_box {
            height: 24px;
            line-height: 24px;
            border: 1px solid #e62442;
            padding: 0 3px;
            text-align: center;
            border-radius: 5px;
            background-color: #fff;
            color: #e62442;
            font-size: 12px;
        }
        .goods_evaluate .goods_tag ul li input {
            display: none;
        }
        .goods_evaluate .goods_text {
        	min-height: 80px;
        	box-sizing: border-box;
        	padding: 10px 15px;
        	font-size: 14px;
        	color: #333;
        }
        .seller_evaluate {
        	background-color: #fff;
        	padding-top: 15px;
        }
        .evaluate_num_box {
            font-size: 14px;
            color: #333;
            padding: 0 15px;
            display: -webkit-box;
            -webkit-box-align: center;
        }
        .evaluate_num_box .evaluate_s {
            margin-bottom: 16px;
        }
        .evaluate_num_box .evaluate_div {
            display: -webkit-box;
            display: -webkit-flex;
            align-items: center;
            margin-left: 26px;
        }
        .evaluate_num_box .evaluate_div .evaluate_icon {
            overflow: hidden;
            margin-right: 7px;
        }
        .evaluate_num_box .evaluate_div .evaluate_icon img {
            height: 19px;
            float: left;
            margin-right: 7px;
        }
        .evaluate_num_box .evaluate_div .evaluate_icon img:last-child {
            margin-right: 0;
        }
        .evaluate_num_box .evaluate_div .evaluate_num {
            font-size: 13px;
            color: #ffa60c;
        }
        .seller_evaluate .evaluate_tag {
        	padding-bottom: 10px;
        	padding: 15px 21px 10px;
        	border-bottom: 1px solid #e8e8e8;
        }
        .seller_evaluate .evaluate_tag ul {
        	overflow: hidden;
            margin: 0 -5px;
        }
        .seller_evaluate .evaluate_tag ul li {
        	min-width: 25%;
        	float: left;
        	margin-bottom: 10px;
            padding: 0 5px;
            box-sizing: border-box;
        }
        .seller_evaluate .evaluate_tag ul li .tag_box {
            height: 24px;
            line-height: 24px;
            border: 1px solid #e62442;
            padding: 0 3px;
            text-align: center;
            border-radius: 5px;
            background-color: #fff;
            color: #e62442;
            font-size: 12px;
        }
        .seller_evaluate .evaluate_tag ul li input {
            display: none;
        }
        .seller_evaluate .evaluate_text {
        	min-height: 80px;
        	box-sizing: border-box;
        	padding: 10px 15px;
        	font-size: 14px;
        	color: #333;
        	border-bottom: 1px solid #e8e8e8;
        }
        .seller_evaluate .evaluate_img {
        	padding: 15px 15px 10px;
        }
        .seller_evaluate .evaluate_img ul {
        	overflow: hidden;
        }
        .seller_evaluate .evaluate_img ul li {
        	float: left;
        	margin-right: 10px;
        	margin-bottom: 10px;
        }
        .seller_evaluate .evaluate_img .img_box {
        	width: 60px;
        	height: 60px;
        }
        .seller_evaluate .evaluate_img .img_box img {
        	width: 100%;
        	height: 100%;
        	object-fit: cover;
        }
        input,textarea {
            outline: none;
        }
    </style>
</head>
<body>
    <div class="seller_info" onclick="fnOpenShop();" tapmode>
    	<div class="seller_info_l">
    		<div class="seller_img" >
    			<img class="shop_img" src="../image/temp/1.png">
    		</div>
    	</div>
    	<div class="seller_info_c shop_title">商家名称</div>
    	<div class="seller_info_r">
    		<img src="../image/right.png">
    	</div>
    </div>
    <div class="title_p goods_comment">商品评价</div>
    <div class="goods_evaluate">
    	<ul class="goods_ul" id="goods_ul">
<!--     		<li class="goods_li">
		    	<div class="goods_info">鱼丸烤肉双拼饭<img src="../image/evaluate_good.png" ><span>好评</span></div>
		    	<div class="goods_tag">
		    		<ul>
                        <li>
                            <div class="tag_box">
                                <input type="checkbox" name="goods_val">
                                干净卫生
                            </div>        
                        </li>
                        <li>
                            <div class="tag_box">
                                <input type="checkbox" name="goods_val">
                                食材新鲜
                            </div>         
                        </li>
                        <li>
                            <div class="tag_box">
                                <input type="checkbox" name="goods_val">
                                分量足
                            </div>             
                        </li>
                        <li>
                            <div class="tag_box">
                                <input type="checkbox" name="goods_val">
                                味道好
                            </div>             
                        </li>
                        <li>
                            <div class="tag_box">
                                <input type="checkbox" name="goods_val">
                                包装精美
                            </div>          
                        </li>
                        <li>
                            <div class="tag_box">
                                <input type="checkbox" name="goods_val">
                                实惠
                            </div>               
                        </li>
                    </ul>
		    	</div>
		    	<div class="goods_text">味道很不错，赞一个</div>
    		</li> -->

    	</ul>
    </div>
    <div class="title_p">商家评价</div>
    <div class="seller_evaluate" id="shop_box">
<!--     	<div class="evaluate_num_box evaluate_s">
            服务态度
            <div class="evaluate_div">
                <div class="evaluate_icon">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_off.png">
                </div>
                <div class="evaluate_num">4.6</div>
            </div>
        </div>
        <div class="evaluate_num_box">
            商品评价
            <div class="evaluate_div">
                <div class="evaluate_icon">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_on.png">
                    <img src="../image/evaluate_off.png">
                </div>
                <div class="evaluate_num">4.6</div>
            </div>
        </div>
    	<div class="evaluate_tag">
    		<ul>
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        干净卫生
                    </div>        
                </li>
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        食材新鲜
                    </div>         
                </li>
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        分量足
                    </div>             
                </li>
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        味道好
                    </div>             
                </li>
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        包装精美
                    </div>          
                </li>
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        实惠
                    </div>               
                </li>
            </ul>
    	</div>
    	<div class="evaluate_text">很棒的餐厅，回头客</div>
    	<div class="evaluate_img">
    		<ul>
    			<li>
    				<div class="img_box">
    					<img src="../image/temp/1.png">
    				</div>
    			</li>

    		</ul>
    	</div> -->
    </div>
        <div class="title_p">骑手评价</div>
        <div class="seller_evaluate" id="staff_box">
    <!--        <div class="evaluate_num_box evaluate_s">
                服务态度
                <div class="evaluate_div">
                    <div class="evaluate_icon">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_off.png">
                    </div>
                    <div class="evaluate_num">4.6</div>
                </div>
            </div>
            <div class="evaluate_num_box">
                商品评价
                <div class="evaluate_div">
                    <div class="evaluate_icon">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_on.png">
                        <img src="../image/evaluate_off.png">
                    </div>
                    <div class="evaluate_num">4.6</div>
                </div>
            </div>
            <div class="evaluate_tag">
                <ul>
                    <li>
                        <div class="tag_box">
                            <input type="checkbox" name="seller_val">
                            干净卫生
                        </div>        
                    </li>
                    <li>
                        <div class="tag_box">
                            <input type="checkbox" name="seller_val">
                            食材新鲜
                        </div>         
                    </li>
                    <li>
                        <div class="tag_box">
                            <input type="checkbox" name="seller_val">
                            分量足
                        </div>             
                    </li>
                    <li>
                        <div class="tag_box">
                            <input type="checkbox" name="seller_val">
                            味道好
                        </div>             
                    </li>
                    <li>
                        <div class="tag_box">
                            <input type="checkbox" name="seller_val">
                            包装精美
                        </div>          
                    </li>
                    <li>
                        <div class="tag_box">
                            <input type="checkbox" name="seller_val">
                            实惠
                        </div>               
                    </li>
                </ul>
            </div>
            <div class="evaluate_text">很棒的餐厅，回头客</div>
            <div class="evaluate_img">
                <ul>
                    <li>
                        <div class="img_box">
                            <img src="../image/temp/1.png">
                        </div>
                    </li>

                </ul>
            </div> -->
        </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script id="shopTpl" type="text/x-dot-template">
    <div class="evaluate_num_box evaluate_s">
        服务态度
        <div class="evaluate_div">
            <div class="evaluate_icon">
                {{for(var i=0;i<it['service_score'];i++){ }}
                    <img src="../image/evaluate_on.png">
                {{ }; }}
                {{for(var i=0;i<5 - it['service_score'];i++){ }}
                    <img src="../image/evaluate_off.png">
                {{ }; }}
            </div>
            <div class="evaluate_num">{{=it['service_score']}}</div>
        </div>
    </div>
    <div class="evaluate_num_box">
        商品评价
        <div class="evaluate_div">
            <div class="evaluate_icon">
                {{for(var i=0;i<it['goods_score'];i++){ }}
                    <img src="../image/evaluate_on.png">
                {{ }; }}
                {{for(var i=0;i<5 - it['goods_score'];i++){ }}
                    <img src="../image/evaluate_off.png">
                {{ }; }}
            </div>
            <div class="evaluate_num">{{=it['goods_score']}}</div>
        </div>
    </div>
    <div class="evaluate_tag">
        <ul>
            {{for(var i=0;i<it['shop_tag'].length;i++){ }}
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        {{=it['shop_tag'][i]['name']}}
                    </div>        
                </li>
            {{ }; }}
        </ul>
    </div>
    <div class="evaluate_text">
        {{if(it['content']){ }}
            {{=it['content']}}
        {{ } else{ }}
            暂无评价
        {{ }; }}
    </div>
    <div class="evaluate_img">
        <ul>
            {{for(var j=0;j<it['shop_comment_picture'].length;j++){ }}
                <li>
                    <div class="img_box">
                        <img src="{{=formatHeadImg(it['shop_comment_picture'][j]['img'])}}">
                    </div>
                </li>
            {{ }; }}
        </ul>
    </div>
</script>
<script id="goodsTpl" type="text/x-dot-template">
    {{for(var i = 0;i<it.length;i++){ }}
        <li class="goods_li">
            <div class="goods_info">{{=it[i]['goods_name']}}{{if(it[i]['opinion'] == 1){ }}<img src="../image/evaluate_good.png" ><span>好评</span>{{ }else{ }}<img src="../image/evaluate_bad.png" ><span>差评</span>{{ }; }}</div>
            <div class="goods_tag">
                <ul>
                    {{for(var j=0;j<it[i]['goods_tag'].length;j++){ }}
                        <li>
                            <div class="tag_box">
                                <input type="checkbox" name="goods_val">
                                {{=it[i]['goods_tag'][j]['name']}}
                            </div>        
                        </li>
                    {{ }; }}
                </ul>
            </div>
            <div class="goods_text">
                {{if(it[i]['content']){ }}
                    {{=it[i]['content']}}
                {{ } else{ }}
                    暂无评价
                {{ }; }}
            </div>
        </li>
    {{ }; }}
</script>
<script id="staffTpl" type="text/x-dot-template">
    <div class="evaluate_num_box evaluate_s">
        服务态度
        <div class="evaluate_div">
            <div class="evaluate_icon">
                {{for(var i=0;i<it['staff']['service_score'];i++){ }}
                    <img src="../image/evaluate_on.png">
                {{ }; }}
                {{for(var i=0;i<5 - it['staff']['service_score'];i++){ }}
                    <img src="../image/evaluate_off.png">
                {{ }; }}
            </div>
            <div class="evaluate_num">{{=it['staff']['service_score']}}</div>
        </div>
    </div>
    <div class="evaluate_num_box">
        配送速度
        <div class="evaluate_div">
            <div class="evaluate_icon">
                {{for(var i=0;i<it['staff']['delivery_score'];i++){ }}
                    <img src="../image/evaluate_on.png">
                {{ }; }}
                {{for(var i=0;i<5 - it['staff']['delivery_score'];i++){ }}
                    <img src="../image/evaluate_off.png">
                {{ }; }}
            </div>
            <div class="evaluate_num">{{=it['staff']['delivery_score']}}</div>
        </div>
    </div>
    <div class="evaluate_tag">
        <ul>
            {{for(var i=0;i<it['staff_tag'].length;i++){ }}
                <li>
                    <div class="tag_box">
                        <input type="checkbox" name="seller_val">
                        {{=it['staff_tag'][i]['name']}}
                    </div>        
                </li>
            {{ }; }}
        </ul>
    </div>
    <div class="evaluate_text">
        {{if(it['staff']['content']){ }}
            {{=it['staff']['content']}}
        {{ } else{ }}
            暂无评价
        {{ }; }}
        
    </div>
</script>
<script type="text/javascript">
    apiready = function(){
        id = api.pageParam.id;
        order_id = api.pageParam.order_id;
        openLoading();
        fnGetCommentDetail();
    };

    function fnGetCommentDetail() {
        user = $api.getStorage('user_data');
        api.ajax({
            url: rootPath+'/api/user/comment_detail',
            method: 'get',
            data: {
                values: { 
                    id: id,
                    order_id : order_id,
                    uid : user.id,
                    token:user.token
                },

            }
        }, function(ret, err) {
            if (ret) {
                if(ret.status == 200) {
                    shop_id = ret.data.shop_id;
                    $('.shop_title').text(ret.data.name);
                    var shop_img = formatHeadImg(ret.data.img);
                    $('.shop_img').attr('src',shop_img);
                    if(ret.data.goods_comment.length > 0){
                        appendDotData(ret.data.goods_comment,'goodsTpl','goods_ul',true,false);
                    }else{
                        // 如果没有商品评论，则隐藏商品评论 - 因为是包裹无需显示
                        $(".goods_comment").text('商品详情');
                        $("#goods_ul").html('<li class="goods_li"><div class="goods_info">包裹商品</div></li>');
                    }
                    setDotData(ret.data,'shopTpl','shop_box',true);
                    // 增加骑手评价
                    setDotData(ret.data,'staffTpl','staff_box',true);

                }
            } else {
                // alert(JSON.stringify(err));
            }
            closeLoading();
        });
    }

    function fnOpenShop() {
        if(shop_id) {
            api.openWin({
                name: 'seller',
                url: './seller.html',
                pageParam: {
                    id: shop_id
                }
            });
        }
    }
</script>
</html>